Skip to content

Conversation

AayushSabharwal
Copy link
Member

Close #3480

@ChrisRackauckas
Copy link
Member

But also test that the derivative of say a datainterpolation is non-zero still.

@ChrisRackauckas
Copy link
Member

Was this found to be okay / safe?

@AayushSabharwal
Copy link
Member Author

Not completely. We don't always want the derivative of a discrete parameter to be zero. One such example is CoSimulation FMUs. The spec enables getting derivatives of outputs, and sometimes MTK needs this information (e.g. if the output of an FMU is in an equation that pantelides differentiates). I think the solution is to allow D(p(t)) ~ ... equations where p is a time-dependent parameter and use that in the mapping added to this PR.

using ModelingToolkit: t_nounits as t, D_nounits as D

sts = @variables x1(t) x2(t) x3(t) x4(t)
params = @parameters u1(t) u2(t) u3(t) u4(t)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hehe

@ChrisRackauckas ChrisRackauckas merged commit 5a6a813 into SciML:master Apr 24, 2025
41 of 44 checks passed
@AayushSabharwal AayushSabharwal deleted the as/param-derivatives branch April 25, 2025 05:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Code generation contains Differential when equations contain variable time parameter
3 participants